Code Search is enabled by default and the previous admin toggle for the code action has been removed.
- Find and understand code by locating specific snippets, recent changes, and relevant files across connected repositories.
- Generate helpful code snippets and starting points based on examples in your codebase.
- Debug faster by tracing recent commits and pull/merge requests that may have introduced issues.
- Check feature implementation status and learn how to enable it by searching code and related docs.
Example usage
- Debug errors: Ask what recent changes could have affected a component and Code Search looks at recent PRs/MRs and commits, then summarizes likely causes with sources.
- Confirm feature status: Ask whether a feature exists and how to enable it and the agent can locate flags, code paths, and docs.
- Implementation guidance: Ask where to add or extend functionality and the agent finds similar changes and suggests files and example code.
Using the Code Search action in an agent
Add Code Search as a step in your agent to retrieve code context before responding.Prerequisites
- Connect a supported code host like GitHub (Cloud), GitHub Enterprise Server, or GitLab.
- For self‑hosted code hosts, ensure the instance is network‑accessible to the Glean crawler running in your cloud.
- Allow Glean to complete a full crawl and index; initial machine learning workflows may take time after connection.
Steps
- Open Agent Builder and add a step.
- Choose the Code Search action (By Glean).
-
Provide the input:
- Natural language: Describe what to find, for example, “recent changes in runtime config loading logic”. Or
- Fixed queries: Provide precise search patterns or templates the agent should issue.
- (Optional) Filter by file extension using the extension field, for example, “py” to focus on Python files.
- Follow the Code Search step with a Respond step that explains how to summarize or extract findings for the user.